package 接口作为成员变量;

public class test {
    public static void main(String[] args) {
        //创建英雄
        Hero one = new Hero();
        one.setName("小黑");
        //
        one.setSkill(new SKillimpl());
        one.attack();
        one.setSkill(new Skill() {
            @Override
            public void useskill() {
                System.out.println("沉默");
            }
        });
        one.attack();
    }
}
